<template>
  <div class="containerTable">
    <!--表5蔬菜生产经营实体表T_VegProsecution-->
    <Row class="divSearch">
            <Col span="24" >
                <label class="searchLabel">县&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(市):</label>
                <Select v-model="searchModel.AreaCode"  placeholder="请选择..." style="width: 100px" @on-change="getPageData()">
                    <Option :value="userInfo.AreaCode">{{(userInfo.AreaCode=='530000000000')?'全省':'全市（州）'}}</Option>
                    <Option :value="item.value" v-for="item in AreaList" :key="item.value">{{item.label}}</Option>
                </Select>
            <!--<Cascader :data="AreaList" change-on-select @on-change='SearchCascaderChange' style="width: 200px;float: left;margin-right: 5px;"></Cascader>-->
            <!--根据需求删除不不要查询条件-->
            填报年度：
            <Select v-model="searchModel.FillInYear" placeholder="全部" style="width: 100px" @on-change="getPageData()">
                <Option value="">全部</Option>
                <Option :value="item.DictValue" v-for="item in CreateYearList" :key="item.DictValue">{{item.DictText}}</Option>
            </Select>
            <!--时间周期：
            <Select v-model="searchModel.TimesType" placeholder="全部" style="width: 100px" @on-change="getPageData()">
                <Option value="">全部</Option>
                <Option :value="item.DictValue" v-for="item in CycleList" :key="item.DictValue">{{item.DictText}}</Option>
            </Select>-->
            报表状态：
            <Select v-model="searchModel.Status" placeholder="全部" :label-in-value="true" @on-change="getPageData()" style="width:200px">
               <Option value="">全部</Option>
                <Option v-for="item in statusList" :value="item.DictValue" :key="item.DictValue">{{ item.DictText }}</Option>
            </Select>
            <Button icon="ios-search" type="ghost" @click="getPageData()">查询</Button>
            </Col>
        </Row>
        <Row>
            <Col span="24">
            <Table size="small" @on-select="selectSingel" @on-select-all="selectAll" :height="clientHeight" border :context="ctx" :columns="columnsList" :data="datas.rows" no-data-text='暂无数据...'></Table>
            </Col>
        </Row>
        <Row>
            <Col span="24">
            <Page class="page-style" :total="datas.total" placement="top" @on-change="getPageNumber" :page-size="searchModel.PageSize" :page-size-opts='pageSizeOpts' show-sizer @on-page-size-change="getPageSize" show-total show-elevator></Page>
            </Col>
        </Row>
        <Modal v-model="showType" :mask-closable="false" width="1000" :styles="{top: '20px'}">
            <p slot="header" class="title">
                <Icon type="ios-paper" size="20"></Icon>
                <span style="font-size: 20px">{{ReportYear}}-{{AreaCodeName}}-技术推广机构及人员情况表（全面统计）</span>
            </p>
            <p slot="close">
                <Icon type="close-circled" color="red" size=25></Icon>
            </p>
            <!-- <table class="reptable" style="width:100%">
                <caption style="font-size: 24px;">水果技术推广机构及人员情况统计表(全面统计)</caption>
                <tr>
                    <th colspan="2">名称</th>
                    <th>汇总代码</th>
                    <th>数量</th>
                </tr>
                <tr>
                    <th colspan="2">甲</th>
                    <th>乙</th>
                    <th>1</th>
                </tr>
                <tr>
                    <th rowspan="4">水果技术服务机构数</th>
                    <td style="text-align:center;height:30px;">合计</td>
                    <td style="text-align:center;height:30px;">1</td>
                    <td style="text-align:right;height:30px;">{{DataModel.InstituNum}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">其中：州市级</td>
                    <td style="text-align:center;">2</td>
                    <td style="text-align:right;">{{DataModel.InstituNum_City}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">县级</td>
                    <td style="text-align:center;">3</td>
                    <td style="text-align:right;">{{DataModel.InstituNum_Area}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">乡镇级</td>
                    <td style="text-align:center;">4</td>
                    <td style="text-align:right;">{{DataModel.InstituNum_town}}</td>
                </tr>
                <tr style="height:30px;">
                    <th rowspan="3">专业技术人员数量</th>
                    <td style="text-align:center;">合计</td>
                    <td style="text-align:center;">5</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">其中：县乡级人数</td>
                    <td style="text-align:center;">6</td>
                    <td style="text-align:right;">{{DataModel.People_County}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">州市级人数</td>
                    <td style="text-align:center;">7</td>
                    <td style="text-align:right;">{{DataModel.People_City}}</td>
                </tr>
                <tr style="height:30px;"> 
                    <th rowspan="3">按性别分</th>
                    <td style="text-align:center;">合计</td>
                    <td style="text-align:center;">8</td>
                    <td style="text-align:right;">{{convertNum(DataModel.PeopleNum+DataModel.PeopleNum_woman)}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">其中：男</td>
                    <td style="text-align:center;">9</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">女</td>
                    <td style="text-align:center;">10</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_woman}}</td>
                </tr>
                <tr style="height:30px;">
                    <th rowspan="5">按年龄分</th>
                    <td style="text-align:center;">合计</td>
                    <td style="text-align:center;">11</td>
                    <td style="text-align:right;">{{convertNum(DataModel.PeopleNum_age1+DataModel.PeopleNum_age2+DataModel.PeopleNum_age3+DataModel.PeopleNum_age4)}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">其中：30岁以下（含30）</td>
                    <td style="text-align:center;">12</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_age1}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">30-40岁（含40）</td>
                    <td style="text-align:center;">13</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_age2}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">40-50岁（含50）</td>
                    <td style="text-align:center;">14</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_age3}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">50岁以上</td>
                    <td style="text-align:center;">15</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_age4}}</td>
                </tr>
                <tr style="height:30px;">
                    <th rowspan="6">按学历层次分</th>
                    <td style="text-align:center;">合计</td>
                    <td style="text-align:center;">16</td>
                    <td style="text-align:right;">{{convertNum(DataModel.PeopleNum_xlss+DataModel.PeopleNum_xlbk+DataModel.PeopleNum_xldz+DataModel.PeopleNum_xlzz+DataModel.PeopleNum_xlqt)}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">其中：硕士及以上</td>
                    <td style="text-align:center;">17</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_xlss}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">本科</td>
                    <td style="text-align:center;">18</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_xlbk}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">大专</td>
                    <td style="text-align:center;">19</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_xldz}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">中专（技校）</td>
                    <td style="text-align:center;">20</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_xlzz}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">其他</td>
                    <td style="text-align:center;">21</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_xlqt}}</td>
                </tr>
                <tr style="height:30px;">
                    <th rowspan="6">职称情况</th>
                    <td style="text-align:center;">合计</td>
                    <td style="text-align:center;">22</td>
                    <td style="text-align:right;">{{convertNum(DataModel.PeopleNum_zczgj+DataModel.PeopleNum_zcfgj+DataModel.PeopleNum_zczj+DataModel.PeopleNum_zccj+DataModel.PeopleNum_zcqt)}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">其中：正高级职称</td>
                    <td style="text-align:center;">23</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_zczgj}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">副高级职称</td>
                    <td style="text-align:center;">24</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_zcfgj}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">中级职称</td>
                    <td style="text-align:center;">25</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_zczj}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">初级职称</td>
                    <td style="text-align:center;">26</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_zccj}}</td>
                </tr>
                <tr style="height:30px;">
                    <td style="text-align:center;">其他</td>
                    <td style="text-align:center;">27</td>
                    <td style="text-align:right;">{{DataModel.PeopleNum_zcqt}}</td>
                </tr>
            </table> -->
            <div style="overflow:auto;height:600px;">
            <table class="reptable">
                <thead>                    
                    <tr>
                        <th style="width:40%">名称</th>
                        <th style="width:30%">分类</th>
                        <th style="width:30%">数量</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <th style="text-align:left;">一、水果技术服务机构数（个）</th>
                        <th></th>
                        <th style="text-align:center;">
                            {{DataModel.InstituNum}}                            
                        </th>
                    </tr>
                    <tr>
                        <td style="text-align:center;" rowspan="3" >其中</td>                                                                      
                        <td style="text-align:center;">州市级</td>                        
                        <td style="text-align:center;">
                            {{DataModel.InstituNum_City}}                            
                        </td>                                                                                                                                                 
                   </tr> 
                    <tr>
                        <td style="text-align:center;">县级</td>                        
                        <td style="text-align:center;">
                            {{DataModel.InstituNum_Area}}                            
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">乡镇级</td>                        
                        <td style="text-align:center;">
                            {{DataModel.InstituNum_town}}                            
                        </td>
                    </tr>   
                    <tr>
                        <th style="text-align:left;" >一、专业技术人员数量（人）</th>
                        <th></th>
                        <th style="text-align:center;">
                            {{DataModel.PeopleNum}}                           
                        </th>
                    </tr>
                     <tr>
                         <td style="text-align:center;" rowspan="2">其中</td>
                        <td style="text-align:center;">县乡级人数</td>                        
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_County}}                            
                        </td>
                    </tr>
                     <tr>
                        <td style="text-align:center;">州市级人数</td>                        
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_City}}                            
                        </td>
                    </tr>
                    <tr>
                        <td rowspan="2" style="text-align:center;">（一）按性别分</td>
                        <td style="text-align:center;">男</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_man}}                            
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">女</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_woman}} 
                        </td>                           
                    </tr>
                    <tr>
                        <td style="text-align:center;" rowspan="4">（二）按年龄分</td>
                        <td style="text-align:center;">其中：30岁以下（含30）</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_age1}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">30-40岁（含40）</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_age2}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">40-50岁（含50）</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_age3}}                            
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">50岁以上</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_age4}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;" rowspan="5">（三）按学历层次分</td>
                        <td style="text-align:center;">其中：硕士及以上</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_xlss}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">本科</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_xlbk}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">大专</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_xldz}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">中专（技校）</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_xlzz}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">其他</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_xlqt}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;" rowspan="5">（四）职称情况</td>
                        <td style="text-align:center;">其中：正高级职称</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_zczgj}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">副高级职称</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_zcfgj}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">中级职称</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_zczj}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">初级职称</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_zccj}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">其他</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_zcqt}}
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div slot="footer" style="padding-bottom:50px">
                <div style="text-align:right;padding-top:5px">
                    <Button type="success" @click="toAlertCheckResult()" style="margin-right:50px">数据检测</Button>
                    <Button type="primary" @click="saveSure()">审核通过</Button>
                    <Button type="warning" @click="savenUnSure()">退回重报</Button>
                </div>
                <Alert style="margin-top:5px;text-align:left" banner type="error">
                    填报时间：每年1月10日</br>
                    填报说明: 1.全省范围内从乡（镇）起，逐级全面统计，由县级填报经州（市）审核后上报。
                    <span slot="desc">
                    </span>
                </Alert>
            </div>
        </Modal>
        <Modal v-model="showAudit" :mask-closable="false" width="500">
            <p slot="header" class="title">
                <Icon type="ios-paper" size="20"></Icon>
                <span style="font-size: 20px">退回重报原因</span>
            </p>
            <p slot="close">
                <Icon type="close-circled" color="red" size=25></Icon>
            </p>
            <Input type="textarea" :rows="4" v-model="strMsg" placeholder="请输入不通过原因..."></Input>
            <div slot="footer">
                <Button type="primary" @click="sureUnSure()">确定</Button>
                <Button type="ghost" @click="cancelUnSure()" style="margin-left: 8px">取消</Button>
            </div>
        </Modal>
        <Modal v-model="ViewShow" :mask-closable="false" width="1000" :styles="{top: '20px'}">
            <p slot="header" class="title">
                <Icon type="ios-paper" size="20"></Icon>
                <span style="font-size: 20px">{{ReportYear}}-{{AreaCodeName}}-技术推广机构及人员情况表（全面统计）</span>
            </p>
            <p slot="close">
                <Icon type="close-circled" color="red" size=25></Icon>
            </p>
            <div style="overflow:auto;height:600px;">
            <table class="reptable">  
                <thead>                  
                    <tr>
                        <th style="width:40%">名称</th>
                        <th style="width:30%">分类</th>
                        <th style="width:30%">数量</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <th style="text-align:left;">一、水果技术服务机构数（个）</th>
                        <th></th>
                        <th style="text-align:center;">
                            {{DataModel.InstituNum}}                            
                        </th>
                    </tr>
                    <tr>
                        <td style="text-align:center;" rowspan="3">其中</td>
                        <td style="text-align:center;">州市级</td>                        
                        <td style="text-align:center;">
                            {{DataModel.InstituNum_City}}                            
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">县级</td>                        
                        <td style="text-align:center;">
                            {{DataModel.InstituNum_Area}}                            
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">乡镇级</td>                        
                        <td style="text-align:center;">
                            {{DataModel.InstituNum_town}}                            
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align:left;" >一、专业技术人员数量（人）</th>
                        <th></th>
                        <th style="text-align:center;">
                            {{DataModel.PeopleNum}}                           
                        </th>
                    </tr>
                     <tr>
                         <td style="text-align:center;" rowspan="2">其中</td>
                        <td style="text-align:center;">县乡级人数</td>                        
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_County}}                            
                        </td>
                    </tr>
                     <tr>
                        <td style="text-align:center;">州市级人数</td>                        
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_City}}                            
                        </td>
                    </tr>
                    <tr>
                        <td rowspan="2" style="text-align:center;">（一）按性别分</td>
                        <td style="text-align:center;">男</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_man}}                            
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">女</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_woman}} 
                        </td>                           
                    </tr>
                    <tr>
                        <td style="text-align:center;" rowspan="4">（二）按年龄分</td>
                        <td style="text-align:center;">其中：30岁以下（含30）</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_age1}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">30-40岁（含40）</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_age2}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">40-50岁（含50）</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_age3}}                            
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">50岁以上</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_age4}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;" rowspan="5">（三）按学历层次分</td>
                        <td style="text-align:center;">其中：硕士及以上</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_xlss}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">本科</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_xlbk}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">大专</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_xldz}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">中专（技校）</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_xlzz}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">其他</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_xlqt}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;" rowspan="5">（四）职称情况</td>
                        <td style="text-align:center;">其中：正高级职称</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_zczgj}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">副高级职称</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_zcfgj}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">中级职称</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_zczj}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">初级职称</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_zccj}}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:center;">其他</td>
                        <td style="text-align:center;">
                            {{DataModel.PeopleNum_zcqt}}
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div slot="footer" style="padding-bottom:50px">
                <Alert style="margin-top:5px;text-align:left" banner type="error">
                    填报时间：每年1月10日</br>
                    填报说明: 1.全省范围内从乡（镇）起，逐级全面统计，由县级填报经州（市）审核后上报。
                    <span slot="desc">
                    </span>
                </Alert>
            </div>
        </Modal>
    </div>
</template>
<script>
export default {
  data() {
    return {
      AreaCodeName: "",
      ReportYear: "",
      ViewShow: false, //查看状态
      Id: "",
      showAudit: false,
      strMsg: "",
      statusList: this.GetGroupDict("ReportStatus"),
      userInfo: this.GetlocaStorage("fruuserinfo"),
      AreaList: [], //所属行政区划数组,
      TableCodeList: this.GetGroupDict("ReportTableName"), //表名称
      CreateYearList: this.GetGroupDict("ReportYear"), //周期
      CycleList: this.GetGroupDict("ReportCycle"), //
      TabTitleList: [], //tab选项卡列表
      selectTabName: "",
      showType: false, //编辑框弹出状态
      ruleValidate: {
        //验证模型
        TableName: [{ required: true, message: "报表名称不能为空", trigger: "blur" }],
        TableCode: [{ required: true, message: "报表代码不能为空", trigger: "blur" }],
        CreateYear: [{ required: true, message: "年度不能为空", trigger: "blur" }],
        Cycle: [{ required: true, message: "时间周期不能为空", trigger: "blur" }],
        CreateTime: [{ required: true, message: "生成时间不能为空", trigger: "blur" }]
      },
      DataModel: {
        //编辑模型
        Id: 0,
        ReportId: "",
        InstituNum: "",
        InstituNum_City: "",
        InstituNum_Area: "",
        InstituNum_town: "",
        PeopleNum: "",
        PeopleNum_man: "",
        PeopleNum_woman: "",
        PeopleNum_age1: "",
        PeopleNum_age2: "",
        PeopleNum_age3: "",
        PeopleNum_age4: "",
        PeopleNum_xlss: "",
        PeopleNum_xlbk: "",
        PeopleNum_xldz: "",
        PeopleNum_xlzz: "",
        PeopleNum_xlqt: "",
        PeopleNum_zczgj: "",
        PeopleNum_zcfgj: "",
        PeopleNum_zczj: "",
        PeopleNum_zccj: "",
        PeopleNum_zcqt: "",
        People_County: "",
        People_City: ""
      },
      //查询模型：根据需求删除不不要查询条件
      searchModel: {
        ReportCode: "FruTecPromotion",
        FillInYear: new Date().getFullYear() + "",
        TimesType: "",
        AreaCode: "",
        Status: "",
        PageNumber: 1,
        PageSize: 20
      },
      pageSizeOpts: [20, 40, 50], //默认分页最大设置
      datas: {}, //table数据对象
      dataIds: [],
      ctx: this, //table数据上下文
      columnsList: [
        //表头对象
        { title: "报表名称", key: "ReportName" },
        //{ title: "填报年度", key: "FillInYear", width: 90 },
        { title: "属行政区划", key: "AreaCodeName", width: 220 },
        //{ title: "填报周期", key: "TimesCycle", width: 90 },
        {
          title: "报表状态",
          key: "StatusName",
          width: 100,
          render: (h, params) => {
            switch (params.row.Status * 1) {
              case 0:
                return h(
                  "span",
                  { style: { color: "#ed3f14" } },
                  params.row.StatusName
                );
              case 1:
                return h(
                  "span",
                  { style: { color: "#ff9900" } },
                  params.row.StatusName
                );
              case 2:
                return h(
                  "span",
                  { style: { color: "#993300" } },
                  params.row.StatusName
                );
              case 3:
                return h(
                  "span",
                  { style: { color: "#2d8cf0" } },
                  params.row.StatusName
                );
              case 4:
                return h(
                  "span",
                  { style: { color: "#19be6b" } },
                  params.row.StatusName
                );
              case 5:
                return h(
                  "span",
                  { style: { color: "#80848f" } },
                  params.row.StatusName
                );
              default:
                return h(
                  "span",
                  { style: { color: "#ff9900" } },
                  params.row.StatusName
                );
            }
          }
        },
        { title: "填报时间", key: "StrUpdateTime", width: 160 },
        {
          title: "操作",
          key: "Id",
          width: 250,
          align: "center",
          render: (h, params) => {
            return h("div", [
              h(
                "Button",
                {
                  class: {
                    ieditColor: true
                  },
                  props: {
                    size: "small",
                    type: "ghost",
                    icon: "ios-paper-outline"
                  },
                  style: {
                    marginRight: "5px"
                  },
                  on: {
                    click: () => {
                      this.ReportYear = params.row.FillInYear;
                      this.AreaCodeName = params.row.AreaCodeName;
                      this.showInfo(params.row.Id, params.row.ReportCode);
                    }
                  }
                },
                "查看"
              ),
              h(
                "Button",
                {
                  class: {
                    ieditColor: true
                  },
                  props: {
                    size: "small",
                    type: "ghost",
                    icon: "network"
                  },
                  style: {
                    marginRight: "5px"
                  },
                  on: {
                    click: () => {
                      this.ReportYear = params.row.FillInYear;
                      this.AreaCodeName = params.row.AreaCodeName;
                      this.editInfo(params.row.Id, params.row.ReportCode);
                    }
                  },
                  attrs: {
                    disabled: params.row.Status == 3 ? false : true
                  }
                },
                "审核"
              ),
              h(
                "Button",
                {
                  class: {
                    ieditColor: true
                  },
                  props: {
                    size: "small",
                    type: "ghost",
                    icon: "ios-undo"
                  },
                  style: {
                    marginRight: "5px"
                  },
                  on: {
                    click: () => {
                      this.unReview(params.row.Id, params.row.ReportCode);
                    }
                  },
                  attrs: {
                    disabled: params.row.Status == 4 ? false : true
                  },
                  directives: [
                    {
                      name: "omg-operation",
                      value: { op: "unreview" }
                    }
                  ]
                },
                "取消审核"
              )
            ]);
          }
        }
      ],
      clientHeight: window.innerHeight - 260 //表格默认高度
    };
  },
  mounted() {
    //table高度计算方法
    const that = this;
    window.onresize = () => {
      return (() => {
        that.clientHeight = window.innerHeight - 260;
      })();
    };
  },
  methods: {
    convertNum: function(num) {
      //小数点处理
      if (isNaN(num)) {
        return "0";
      }
      return Number(num).toFixed(0);
    },
    //初始化行政区划树
    SearchAreaList() {
      var areaCode = this.userInfo.AreaCode;
      // console.log(areaCode);
      var areaList = [];
      if (areaCode != "530000000000" && areaCode != null) {
        var item = this.GetlocaStorage("areatreelist")[0];
        for (var i = 0; i < item.children.length; i++) {
          if (item.children[i].value == areaCode) {
            areaList.push(item.children[i]);
          }
        }
      } else {
        areaList = this.GetlocaStorage("areatreelist");
      }
      this.AreaList = areaList[0].children;
    },
    // SearchAreaList() {
    //     var areaCode = this.userInfo.AreaCode;
    //     if (areaCode != '530000000000') {
    //         var item = this.GetlocaStorage("areatreelist")[0];
    //         for (var i = 0; i < item.children.length; i++) {
    //             if (item.children[i].value == areaCode) {
    //                 this.AreaList.push(item.children[i]);
    //             }
    //         }
    //     } else {
    //         this.AreaList = this.GetlocaStorage("areatreelist");
    //     }
    // },
    // //查询行政区划级联选择
    // SearchCascaderChange(value, selectedData) {
    //     const index = value.length - 1;
    //     this.searchModel.AreaCode = value[index];
    // },
    getTab(name) {
      //console.log(name);
      this.selectTabName = name;
    },
    //查看报表
    showInfo(id, reportCode) {
      var self = this;
      this.$http
        .get("Report", { params: { id: id, reportCode: reportCode } })
        .then(
          //获取数据编辑项的值
          function(res) {
            switch (res.data.list.status) {
              case 1:
                self.DataModel = res.data.list.model;
                self.ViewShow = true;
                break;
              case 0:
                self.$Modal.error({ title: "提示信息", content: "编辑数据加载失败!!!" });
                break;
              case -1:
                self.$Modal.error({ title: "提示信息", content: "编辑数据加载失败!!!" });
                break;
            }
          }
        );
    },
    //获取当前页码
    getPageNumber(pageIndex) {
      this.searchModel.PageNumber = pageIndex;
      this.initPageData();
    },
    //获取当前分页大小
    getPageSize(pageSize) {
      this.searchModel.PageSize = pageSize;
      this.initPageData();
    },
    initPageData() {
      var areaCode = this.userInfo.AreaCode;
      this.searchModel.AreaCode = areaCode;
      this.getPageData();
    },
    //获取this.datas: {},//table数据对象
    getPageData() {
      var self = this;
      self.$http
        .post("Report/PostReviewPageList", this.searchModel)
        .then(function(res) {
          if (res.data.status === 1) {
            self.datas = res.data;
          } else {
            self.$Modal.error({ title: "提示信息", content: res.data.message });
          }
        });
    },
    //编辑获取对象传入id
    editInfo(id, reportCode) {
      //编辑
      var self = this;
      this.Id = id;
      this.$http
        .get("Report", { params: { id: id, reportCode: reportCode } })
        .then(
          //获取数据编辑项的值
          function(res) {
            switch (res.data.list.status) {
              case 1:
                self.DataModel = res.data.list.model;
                self.modalShow();
                break;
              case 0:
                self.$Modal.error({ title: "提示信息", content: "编辑数据加载失败!!!" });
                break;
              case -1:
                self.$Modal.error({ title: "提示信息", content: "编辑数据加载失败!!!" });
                break;
            }
          }
        );
    },
    initTab(self, datas) {
      self.TabTitleList = [];
      for (var i = 0; i < datas.length; i++) {
        if (!self.checkTab(datas[i].SortCode, self)) {
          var item = new Object();
          item.SortCode = datas[i].SortCode;
          item.SortName = datas[i].SortName;
          item.list = [];
          for (var j = 0; j < datas.length; j++) {
            if (datas[j].SortCode == datas[i].SortCode) {
              if (!self.checkItem(item.list, datas[j].ItemCode)) {
                item.list.push(datas[j]);
              }
            }
          }
          self.TabTitleList.push(item);
        }
      }
      return self.TabTitleList;
    },
    checkTab(SortCode, self) {
      var res = false;
      for (var i = 0; i < self.TabTitleList.length; i++) {
        if (self.TabTitleList[i].SortCode == SortCode) {
          res = true;
        }
      }
      return res;
    },
    checkItem(datas, ItemCode) {
      var res = false;
      for (var i = 0; i < datas.length; i++) {
        if (datas[i].ItemCode == ItemCode) {
          res = true;
        }
      }
      return res;
    },
    //删除对象
    delInfo(id) {
      var self = this;
      self.$Modal.confirm({
        title: "提示信息",
        content: "<p>数据删除后不可恢复，确定要删除？</p>",
        onOk: () => {
          this.$http
            .delete("GenerateLog", { params: { id: id } })
            .then(function(res) {
              if (res.data.status == 1) {
                self.$Notice.success({ title: "删除成功！", desc: false });
                self.initPageData();
              } else {
                self.$Modal.error({ title: "提示信息", content: "数据删除失败!!!" });
              }
            });
        }
      });
    },
    //省级取消审核
    unReview(id, reportCode) {
      var model = new Object();
      model.Id = id;
      model.reportType = "0";
      model.strMsg = "省级已取消审核!";
      this.save(model);
    },
    //审核
    save(model) {
      var self = this;
      this.$http.post("Report/PostUpStatus", model).then(function(res) {
        if (res.data.status == 1) {
          self.$Notice.success({ title: "审核完成!", desc: false });
          self.Id = "";
          self.getPageData();
          self.strMsg = "";
          self.modalHide();
        } else {
          self.$Modal.error({ title: "提示信息", content: "数据审核失败!!!" });
        }
      });
    },
    saveSure() {
      var model = new Object();
      model.Id = this.Id;
      model.reportType = "4";
      model.strMsg = "";
      this.save(model);
      this.modalHide();
    },
    //审核未通过
    savenUnSure() {
      var self = this;
      this.showAudit = true;
    },
    sureUnSure() {
      this.showAudit = false;
      var model = new Object();
      model.Id = this.Id;
      model.reportType = "0";
      model.strMsg = this.strMsg;
      this.save(model);
    },
    cancelUnSure() {
      this.showAudit = false;
      //this.modalHide();
      this.strMsg = "";
    },
    convertNum: function (num) { //小数点处理
            if (isNaN(num)||num == null||num=='') {
                return 0;
            }
            return num*1;
        },
    checkData(){
        var self = this;       
           if((this.convertNum(self.DataModel.InstituNum_City)+this.convertNum(self.DataModel.InstituNum_Area)+ this.convertNum(self.DataModel.InstituNum_town)) != this.convertNum(self.DataModel.InstituNum)){
                return "水果技术服务机构数应等于其中子项加起来的和!";                      
            }
            else if((this.convertNum(self.DataModel.PeopleNum_County)+this.convertNum(self.DataModel.PeopleNum_City))!= this.convertNum(self.DataModel.PeopleNum)){
                return "专业技术人员数量应等于其中子项加起来的和!";                                   
            }
            else if((this.convertNum(self.DataModel.PeopleNum_man)+this.convertNum(self.DataModel.PeopleNum_woman))!= this.convertNum(self.DataModel.PeopleNum)){
                return "专业技术人员数量应等于按性别分加起来的和!";                                       
            }
            else if((this.convertNum(self.DataModel.PeopleNum_age1)+this.convertNum(self.DataModel.PeopleNum_age2)+this.convertNum(self.DataModel.PeopleNum_age3)+this.convertNum(self.DataModel.PeopleNum_age4))!= this.convertNum(self.DataModel.PeopleNum)){
                return "专业技术人员数量应等于按年龄分加起来的和!";                                    
            }
            else if((this.convertNum(self.DataModel.PeopleNum_xlss)+this.convertNum(self.DataModel.PeopleNum_xlbk)+this.convertNum(self.DataModel.PeopleNum_xldz)+this.convertNum(self.DataModel.PeopleNum_xlzz)+this.convertNum(self.DataModel.PeopleNum_xlqt)) != this.convertNum(self.DataModel.PeopleNum)){
               return "专业技术人员数量应等于按学历层次分加起来的和!";                                     
            }
            else if((this.convertNum(self.DataModel.PeopleNum_zczgj)+this.convertNum(self.DataModel.PeopleNum_zcfgj)+this.convertNum(self.DataModel.PeopleNum_zczj)+this.convertNum(self.DataModel.PeopleNum_zccj)+this.convertNum(self.DataModel.PeopleNum_zcqt)) != this.convertNum(self.DataModel.PeopleNum)){
               return "专业技术人员数量应等于按职称情况分加起来的和!";                                     
            }
            else {
                return '数据检测无误！';
            }
    },
    toAlertCheckResult(){ 
      var message  = this.checkData();   
      this.$Modal.warning({
        title:'提示信息',
        content:message
      });
    },
    //编辑框打开
    modalShow() {
      this.showType = true;
    },
    //编辑框关闭
    modalHide() {
      this.showType = false;
    },
    //取消方法
    cancel() {
      this.showType = false; //关闭modal
      this.TabTitleList = [];
    },
    //重置model
    restModel(modelname) {
      this.$refs[modelname].resetFields(); //重置model
    },
    //全选方法
    selectAll(selection) {
      this.dataIds = selection;
    },
    //checkbox选中方法
    selectSingel(selection, row) {
      this.dataIds = selection;
    },
    //checkbox取消选中方法
    selecChange(selection) {
      this.dataIds = selection;
    },
    //批量删除
    multiSelect() {
      var self = this;
      if (this.dataIds.length !== 0) {
        self.$Modal.confirm({
          title: "提示信息",
          content: "<p>数据删除后不可恢复，确定要删除？</p>",
          onOk: () => {
            var ids = this.getDataIds(this.dataIds);
            this.$http
              .post("GenerateLog/PostBatchDelete", ids)
              .then(function(res) {
                if (res.data.status == 1) {
                  self.dataIds = [];
                  self.$Notice.success({ title: "删除成功！", desc: false });
                  self.initPageData();
                } else {
                  self.$Modal.error({ title: "提示信息", content: "数据删除失败!!!" });
                }
              });
          }
        });
      } else {
        self.$Modal.warning({ title: "提示信息", content: "请选择需要删除的数据!" });
      }
    },
    getDataIds(idList) {
      var ids = [];
      if (idList.length !== 0) {
        for (var i = 0; i < idList.length; i++) {
          ids.push(idList[i].Id);
        }
      }
      return ids;
    },
    currentYear() {
      let year = new Date().getFullYear();
      let month = new Date().getMonth();
      if (month > 1) {
        this.searchModel.FillInYear = year.toString();
      } else {
        this.searchModel.FillInYear = (year - 1).toString();
      }
    }
  },
  //创建Vue页面方法
  created: function() {
    //创业Vue前调用获取this.datas: {},//table数据对象
    this.currentYear();
    this.initPageData();
    this.SearchAreaList();
  },
  watch: {
    //需要监听的在此处新增监听对象
  }
};
</script>
